import request from '@/utils/request';

/**
 * 获取用户列表
 * POST /promo-admin-api/user/list
 */
export async function queryUserList(data: API.UserParam, options?: API.baseOption) {
  return request<API.PageUserList>('/user/list', {
    method: 'GET',
    data,
    ...(options || {}),
  });
}

/**
 * 获取用户详情
 * POST /promo-admin-api/user/getUserDetail
 */
export async function queryUserDetail(data: Record<'id', string>, options?: API.baseOption) {
  return request<API.UserItem>('/user/getUserDetail', {
    method: 'GET',
    data,
    ...(options || {}),
  });
}

/**
 * 新增或者修改用户
 * POST /promo-admin-api/user/saveOrUpdate
 */
export async function saveOrUpdateUser(data: API.UserDetailParams, options?: API.baseOption) {
  return request<string>('/user/saveOrUpdate', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 删除用户
 * POST /promo-admin-api/user/delete
 */
export async function deleteUser(data: Record<'id', string>, options?: API.baseOption) {
  return request<string>('/user/delete', {
    method: 'GET',
    data,
    ...(options || {}),
  });
}
